/*
 *  AMPStoryNodeID.h
 *  AMPlugin
 *
 *  Created by Vu Tiet on 8/10/12.
 *  Copyright 2012 __MyCompanyName__. All rights reserved.
 *
 */

#ifndef __AMPStoryNodeID__
#define __AMPStoryNodeID__

#include "NodeID.h"
#include "IPMStream.h"
#include "AMPID.h"
#include <iostream>
using namespace std;

/** Represents a node in the tree view. It is the list item.
 
 @ingroup wlistboxcomposite
 */
class AMPStoryNodeID : public NodeIDClass
	{
	public:
		enum { kNodeType = kAMPStoryTreeViewWidgetBoss }; 
		
		
		/**	Factory method to create 
		 new object of this class
		 @return   new instance of this class 
		 */
		static	NodeID_rv Create() { return new AMPStoryNodeID(); }
		
		/**	Factory method to create new object of this class
		 @param path [IN] specifies initial path
		 @return  new instance of this class
		 */
		static	NodeID_rv Create(PMString name)  
		{ return new AMPStoryNodeID(name); }
		
		static NodeID_rv Create(PMString id, PMString name) {
			//cout << "create AMStoryNodeID: " << id.GrabCString() << " - " << name.GrabCString() << endl;
			return new AMPStoryNodeID(id, name);
		}
		
		/**	Destructor
		 */
		virtual ~AMPStoryNodeID() {}
		
		
		/**	@return type of this node
		 */
		virtual	NodeType GetNodeType() const { return kNodeType; } 
		
		/**	Comparator function
		 @param NodeID [IN] specifies the node that we should compare against
		 @return  Comparison results
		 */
		virtual int32 Compare(const NodeIDClass* NodeID) const;
		
		/**	Create a copy of this
		 @return  
		 */
		virtual NodeIDClass* Clone() const;
		
		/**	Read this from the given stream
		 @param stream [IN] specified stream
		 @return  
		 */
		virtual void Read(IPMStream* stream);
		
		/**	Write this to the given stream
		 @param [OUT] stream 
		 @return  
		 */
		virtual void Write(IPMStream* stream) const;
		
		/**	Accessor for the value associated with this node
		 @return const PMString& 
		 */
		const PMString& GetName() const { return fName; }
		
		const PMString& GetId() const { return fId; }
		
		
	private:
		// Note we're keeping the destructor private to force use of the factory methods
		AMPStoryNodeID() {}
		
		AMPStoryNodeID(PMString name):fName(name) {}
		
		AMPStoryNodeID(PMString idx, PMString name):fId(idx), fName(name) {}
		
		PMString	fName;
		PMString	fId;
	};

#endif // __AMPStoryNodeID__